<%@ Page Language="C#" MasterPageFile="~/Master/PlacementManager.master" StylesheetTheme="YUI"
    Theme="YUI" AutoEventWireup="true" CodeFile="ManageStudentAttributes.aspx.cs"
    Inherits="Home_ManageStudentAttributes" Title="Placement Manager: Student Attributes" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div class="yui-b">
    </div>
    <div id="yui-main">
        <h1>
            Manage Student Attributes</h1>
        <br />
        <p>
            Student attributes are qualifications or sertifications that a Division may wish
            to record for their students. Use this form to add or edit attributes,</p>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="updtpnlStudentAttributes" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:GridView ID="gvStudentAttributes" runat="server" AutoGenerateColumns="False"
                    DataSourceID="ldsStudentAttributes" DataKeyNames="StudentAttributeID" OnRowUpdating="gvStudentAttributes_RowUpdating"
                    SkinID="Results" AllowSorting="True">
                    <Columns>
                        <asp:CommandField CancelImageUrl="~/Images/Icons/against.gif" SelectImageUrl="~/Images/Icons/edit.gif"
                            ShowEditButton="True" UpdateImageUrl="~/Images/Icons/refresh.gif" ButtonType="Image"
                            EditImageUrl="~/Images/Icons/edit.gif" />
                        <asp:BoundField DataField="StudentAttributeName" HeaderText="Name" SortExpression="StudentAttributeName" />
                        <asp:CheckBoxField DataField="AttributeExpires" HeaderText="Attribute Expires" SortExpression="AttributeExpires" />
                        <asp:BoundField DataField="DateCreated" HeaderText="Date Created" SortExpression="DateCreated"
                            DataFormatString="{0:MMM dd, yyyy}" HtmlEncode="False" ReadOnly="True" />
                        <asp:BoundField DataField="CreatedBy" HeaderText="Created By" SortExpression="CreatedBy"
                            ReadOnly="True" />
                        <asp:BoundField DataField="DateUpdated" HeaderText="Date Updated" SortExpression="DateUpdated"
                            DataFormatString="{0:MMM dd, yyyy}" HtmlEncode="False" ReadOnly="True" />
                        <asp:BoundField DataField="UpdatedBy" HeaderText="Updated By" SortExpression="UpdatedBy"
                            ReadOnly="True" />
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnAddNewAttribute" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:UpdatePanel runat="server" ID="updtPnlAddStudentAttributes" UpdateMode="Conditional">
            <ContentTemplate>
                <fieldset>
                    <legend id="lgdAddNote">Add Attributes:</legend>
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblNewAttributeName" runat="server" Text="Name:" CssClass="formLabel"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtNewAttributeName" runat="server" 
                                    ValidationGroup="InsertStudentAttribute"></asp:TextBox><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" 
                                    ControlToValidate="txtNewAttributeName" 
                                    ValidationGroup="InsertStudentAttribute"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="Attribute expires:" CssClass="formLabel"></asp:Label>
                            </td>
                            <td>
                                <asp:CheckBox ID="cbNewAttributeExpires" runat="server" Text="" TextAlign="Left"
                                    CssClass="formLabel" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:ImageButton ID="btnAddNewAttribute" runat="server" CssClass="inputbutton" OnClick="btnAddNewAttribute_Click"
                                    ImageUrl="~/Images/Icons/diskette.gif" 
                                    ValidationGroup="InsertStudentAttribute" />
                            </td>
                        </tr>
                    </table>
                    <asp:LinqDataSource ID="ldsStudentAttributes" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                        EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="StudentAttributes"
                        OnSelecting="ldsStudentAttributes_Selecting">
                    </asp:LinqDataSource>
                </fieldset>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="gvStudentAttributes" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
